<?php
    
if (!defined('BASEPATH'))
    exit('No direct script access allowed');
session_start();

class social extends CI_Controller {
    public function __construct() {
        parent::__construct();
        if ($this->session->userdata('logged_in_user')) {
            $this->logged_in = TRUE;
        } else {
            redirect('login/', 'refresh');
        }
        $this->load->model('Dao');
        $this->load->helper('date');
    }
    
    public function search(){
        $data = array('user' => $this->session->userdata('logged_in_user'));
        
        $keywords = $this->input->post("search");
        $users = $this->Dao->searchForUsers($keywords);
        
        $data['users'] = $users;
        $this->load->view('v_users', $data);
//        echo json_encode($users);
    }
    
    
}
?>
